<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width"/>
    <title>HELLO，AMAP!</title>
    <style>
        html,
        body,
        #container {
            width: 100%;
            height: 100%;
        }
    </style>
</head>
<body>
<div id="container"></div>
</body>
</html>
<script type="text/javascript">
    window._AMapSecurityConfig = {
        securityJsCode: "b4a922fec0bec6528e909210d2242fe1",
    };
</script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=2.0&key=c50b37cfeb77a5ce1ce927c96b9d80d4"></script>
<script type="text/javascript">
    var zoom = 16
    //地图初始化应该在地图容器 <div> 已经添加到 DOM 树之后
    var map = new AMap.Map("container", {
        zoom: zoom,
        center: [116.397428, 39.90923], //地图中心点
<!--        mapStyle: "amap://styles/whitesmoke", //设置地图的显示样式-->
<!--        viewMode: "2D", //设置地图模式-->
    });


    function getSearchWay(start, end) {
        const points = [
          { keyword: start }, //起始点坐标
          { keyword: end } //终点坐标
        ]

        //引入和创建驾车规划插件
        map.plugin(["AMap.Driving"], function () {
          const driving = new AMap.Driving({
            map: map
            //驾车策略，包括 LEAST_TIME，LEAST_FEE, LEAST_DISTANCE,REAL_TRAFFIC
            policy: AMap.DrivingPolicy.LEAST_TIME
          });
          //获取起终点规划线路
          driving.search(points, function (status, result) {});
         });
    }
</script>